﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QKeyEvent>
#include <QActionGroup>
#include <QClipboard>
#include <QButtonGroup>
#include "src/Widgets/MultPlot.h"

struct  ChartDatas{
    std::vector<double> vals;
    std::string legend;
};

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void Copy2Clip();
    void Clip2Table(QString );

    QString Table2Str();

    void ReflushChart();

    void clearCharts();
protected slots:
    void keyPressEvent(QKeyEvent *e);
    void on_tableWidget_customContextMenuRequested(const QPoint &pos);
private slots:
    void slotActionInsert();
    void slotActionRemove();
    void slotActionRemoveAItem();
    void slotActionCleanCol();

    void on_actionReflush_triggered();

    void on_pb_set_clicked();

    void on_pb_autoTick_clicked();

    void on_actionReflush_2_triggered();

    void on_actionClean_triggered();

    void on_actionSave_triggered();

    void on_action_hide_triggered(bool checked);

    void on_action_assis_triggered(bool checked);

    void on_action_import_triggered();

    void on_action_save_triggered();

    void on_actionClear_triggered();

    void on_actionLine_triggered();

    void on_actionNone_triggered();

    void on_actionVersion_triggered();

    void on_actionGridVisible_toggled(bool arg1);

private:
    Ui::MainWindow *ui;
    QClipboard *clipboard;
    QMenu *table_widget_menu;   // 右键菜单
    QButtonGroup *m_group;

    QActionGroup *m_group_heng;
    QActionGroup *m_group_ver;

    bool curIsPos = false;  // 当前是否pos

    MultPlot *plot;     // 图表widget

    void initUIs();
    void getXYZ();
    void getLen();
};
#endif // MAINWINDOW_H
